package vip.xiaonuo.biz.modular.canteen.result;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.Setter;

import java.math.BigDecimal;
import java.util.Date;
@Getter
@Setter
public class BizCanteenResult {


    /** 主键 */
    @TableId
    @Schema(description = "主键")
    private String id;

//    /** 组织ID */
//    @Schema(description = "组织ID")
//    private String orgId;

    /** 食堂名称 */
    @Schema(description = "食堂名称")
    private String canteenName;

    /** 食堂午餐价格 */
    @Schema(description = "食堂午餐价格")
    private BigDecimal canteenLunchPrice;

    /** 食堂晚餐价格 */
    @Schema(description = "食堂晚餐价格")
    private BigDecimal canteenDinnerPrice;

    /** 食堂价格是否可修改 */
    @Schema(description = "食堂价格是否可修改")
    private String canteenPriceModifyFlag;

    /** 扩展信息 */
    @Schema(description = "扩展信息")
    private String extJson;

    /** 删除标志 */
    @Schema(description = "删除标志")
    @TableLogic
    @TableField(fill = FieldFill.INSERT)
    private String deleteFlag;

    /** 创建时间 */
    @Schema(description = "创建时间")
    @TableField(fill = FieldFill.INSERT)
    private Date createTime;

    /** 创建用户 */
    @Schema(description = "创建用户")
    @TableField(fill = FieldFill.INSERT)
    private String createUser;

    /** 更新时间 */
    @Schema(description = "更新时间")
    @TableField(fill = FieldFill.UPDATE)
    private Date updateTime;

    /** 更新用户 */
    @Schema(description = "更新用户")
    @TableField(fill = FieldFill.UPDATE)
    private String updateUser;

    /** 组织名称 */
    @Schema(description = "组织名称")
    private String orgName;
    /** 审批单ID */
    @Schema(description = "审批单ID")
    private String approvalId;

    /** 审批单ID */
    @Schema(description = "审批单ID")
    private Boolean isLunch;

    public JSONObject getExtJsonObject() {
        JSONObject object = JSON.parseObject(this.extJson);
        if (object == null){
            return new JSONObject();
        }
        return object;
    }
}
